<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@page import="pedidos.ejercicio.model.FormaPago"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	request.setAttribute("path",request.getContextPath());
%>
<html> 
 <head>
  <title>JSP for DetallePedidoForm form</title>
  <jsp:include page="/includes.jsp"></jsp:include>
 </head>
 <body>
  <jsp:include page="/menu-bar.jsp"></jsp:include>
  <div class="container">
   <h1> Eliminar Pago de pedido </h1>
   <form action="${path}/pago/eliminar.do">
    Pedido :
    <select name="select" id="selectlist" onChange="showDetails()">
     <option value="-1" >  </option>
     <c:forEach var="row" items="${pedidos}">
      <option value="${row.id}"> #${row.id} | ${row.cliente.nombre} ${row.cliente.apellido} </option>
     </c:forEach>
    </select>
    <input type="hidden" id="deletePago"/>
    <table id="info_wrapper" class="hidden">
     <tr >
      <th> Pedido ID</th>
      <th> Abonante </th>
      <th> Fecha </th>
      <th> Monto </th>
      <th> Eliminar? </th>
     </tr>
     <c:forEach var="row" items="${pedidos}">
      <c:if test="${ !empty row.formaPagos}">
       <c:forEach var="row2" items="${row.formaPagos}">
        <tr id="${row2.id}_info" class="${row.id}_info row">
         <td> ${row2.pedidos.id }</td>
         <td> ${row2.propietario}</td>
         <td> ${row2.fechaPago}</td>
         <td> ${row2.monto}</td>
         <td> <input name="selectedPago" value="${row2.id}" type="radio" onclick="savePagoId()"> </td>
        </tr>
       </c:forEach> 
      </c:if>
     </c:forEach>
    </table>
    <input type="submit" value="Eliminar"/>
   </form>
  </div> 
  <hr/>
 </body>
</html>


